﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;

/*
 * Deve conter os status (id_status, ds_status)
 * 1, Ativo
 * 2, Inativo
 * 3, Bloqueado 
 * 
 */
namespace Persistente.Auxiliar
{
    public class PStatus
    {
        private DB_SIMETRIA _db;
        private SqlConnection _conexao = new SqlConnection(ConfigurationManager.ConnectionStrings["DB_SIMETRIA_SQL"].ConnectionString);

        public List<tb_status> pegarTodosStatus()
        {
            var listStatus = new List<tb_status>();
            try
            {
                _db = new DB_SIMETRIA();
                listStatus = _db.tb_status.ToList();
            }catch(Exception e)
            {
                throw;
            }finally
            {
                _db.Connection.Close();
            }
            return listStatus;

        }

        public tb_status pegarStatusPorId(int idStatus)
        {
            try
            {
                _db = new DB_SIMETRIA();
                return _db.tb_status.Where(q => q.id_status == idStatus).FirstOrDefault();
            }catch(Exception e)
            {
                throw;
            }finally
            {
                _db.Connection.Close();
            }
        }
    }
}
